package cgo

/*
 #include<stdlib.h>
*/
import "C"
import "unsafe"

func GoStringToCString(value string) (cptr *int8, release func()) {
	cString := unsafe.Pointer(C.CString(value))
	cptr = (*int8)(cString)
	return cptr, func() {
		C.free(cString)
	}
}

func CStringToGoString(cptr *int8) string {
	return C.GoString((*C.char)(unsafe.Pointer(cptr)))
}
